/*
 *  Copyright 2012 Dirk Vranckaert
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package eu.vranckaert.vvl.tmp;

import java.util.ArrayList;
import java.util.List;

/**
 * User: DIRK VRANCKAERT
 * Date: 16/02/12
 * Time: 14:36
 */
public class Test {
    public static void main(String args[]) {
        //createHighRoadsStrings();
        createSecondaryRoadsStrings();
    }

    private static void createHighRoadsStrings() {
        String text = "<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000010|21\">R0 Binnenring Brussel</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000012|78\">&nbsp;&nbsp;&nbsp;R0 Binnenring Brussel: Zuid tot KNP Groot-Bijgaarden</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000014|80\">&nbsp;&nbsp;&nbsp;R0 Binnenring Brussel: KNP Groot-Bijgaarden tot KNP Machelen</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000016|82\">&nbsp;&nbsp;&nbsp;R0 Binnenring Brussel: KNP Machelen tot Zuid</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000020|22\">R0 Buitenring Brussel</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000022|83\">&nbsp;&nbsp;&nbsp;R0 Buitenring Brussel: Zuid tot KNP Machelen</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000024|81\">&nbsp;&nbsp;&nbsp;R0 Buitenring Brussel: KNP Machelen tot KNP Groot-Bijgaarden</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000026|79\">&nbsp;&nbsp;&nbsp;R0 Buitenring Brussel: KNP Groot-Bijgaarden tot Zuid</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000030|23\">R1 Binnenring Antwerpen: Antw. Noord > Antw. West (1)</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000040|24\">R1 Buitenring Antwerpen: Antw. West > Antw. Noord (2)</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000050|25\">R2 Buitenring Antwerpen: Antw. Haven > Beveren (2)</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000060|26\">R2 Binnenring Antwerpen: Beveren > Antw. Haven (1)</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000070|43\">Ring Gent (R4)</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000080|56\">Ring Kortrijk (R8) Binnenring</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000090|57\">Ring Kortrijk (R8) Buitenring</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000100|31\">E17 Antwerpen -> Gent</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000110|32\">E17 Gent -> Antwerpen</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000120|33\">E17 Gent -> Rijsel (F)</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000130|34\">E17 Rijsel (F) -> Gent</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000140|30\">E19 Antwerpen -> Brussel</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000142|66\">&nbsp;&nbsp;&nbsp;E19 Antwerpen -> Mechelen N.</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000144|67\">&nbsp;&nbsp;&nbsp;E19 Mechelen N. -> Brussel</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000150|29\">E19 Brussel -> Antwerpen</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000152|68\">&nbsp;&nbsp;&nbsp;E19 Brussel -> Mechelen N.</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000154|69\">&nbsp;&nbsp;&nbsp;E19 Mechelen N. -> Antwerpen</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000160|27\">E19 Antwerpen -> Breda (Nl)</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000170|28\">E19 Breda (Nl) -> Antwerpen</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000180|44\">E313 Antwerpen -> Luik</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000182|70\">&nbsp;&nbsp;&nbsp;E313/E34 Antwerpen -> Ranst</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000184|71\">&nbsp;&nbsp;&nbsp;E313 Ranst -> Luik</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000190|45\">E313 Luik -> Antwerpen</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000192|73\">&nbsp;&nbsp;&nbsp;E313 Luik -> Ranst</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000194|72\">&nbsp;&nbsp;&nbsp;E313/E34 Ranst -> Antwerpen</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000200|51\">E314 Leuven -> Heerlen (Nl)</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000210|50\">E314 Heerlen (Nl) -> Leuven</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000220|46\">E34 Ranst -> Eindhoven (Nl)</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000230|47\">E34 Eindhoven (Nl) -> Ranst</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000240|39\">E34/N49 Antwerpen -> Knokke</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000250|40\">E34/N49 Knokke -> Antwerpen</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000260|38\">E40 Brussel -> Gent</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000270|37\">E40 Gent -> Brussel</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000280|48\">E40 Brussel -> Luik</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000282|74\">&nbsp;&nbsp;&nbsp;E40 Brussel -> Heverlee</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000284|75\">&nbsp;&nbsp;&nbsp;E40 Heverlee -> Luik</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000290|49\">E40 Luik -> Brussel</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000292|76\">&nbsp;&nbsp;&nbsp;E40 Luik -> Heverlee</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000294|77\">&nbsp;&nbsp;&nbsp;E40 Heverlee -> Brussel</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000300|36\">E40 Gent -> Oostende</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000310|35\">E40 Oostende -> Gent</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000320|62\">E40 Oostende -> Duinkerke (F)</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000330|63\">E40 Duinkerke (F) -> Oostende</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000340|58\">E403 Brugge -> Kortrijk</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000350|59\">E403 Kortrijk -> Brugge</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000360|52\">E411 Brussel -> Namen</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000370|53\">E411 Namen -> Brussel</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000380|64\">E429 Halle -> Doornik</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000390|65\">E429 Doornik -> Halle</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000400|42\">A12 Antwerpen -> Brussel</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000410|41\">A12 Brussel -> Antwerpen</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000420|60\">A12 Bergen-op-Zoom (Nl) -> Antwerpen</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000430|61\">A12 Antwerpen -> Bergen-op-Zoom (Nl)</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000440|54\">A19 Kortrijk -> Ieper</option>\n" +
                "                           \t\t\t\t\t\t\t\t<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000450|55\">A19 Ieper -> Kortrijk</option>";

        String[] lines = text.split("\n");

        List<String> stringEntries = new ArrayList<String>();
        List<String> enumEntries = new ArrayList<String>();
        for (String line : lines) {
            String[] lineParts = line.split("\">");
            String valueString = lineParts[0].substring(lineParts[0].length()-2, lineParts[0].length());
            int value = Integer.parseInt(valueString);
            String textToUse = lineParts[1].replace("</option>", "");

            String stringsEntry = "<item>" + textToUse + "</item>";
            String enumEntry = "Highroad_" + value + "(" + value + ")";

            stringEntries.add(stringsEntry);
            enumEntries.add(enumEntry);
        }

        System.out.println("Entries for the strings.xml files:");
        
        for (String s : stringEntries) {
            System.out.println(s);
        }

        System.out.println("Entries for the enum:");

        for (String s : enumEntries) {
            System.out.println(s + ",");
        }
    }

    private static void createSecondaryRoadsStrings() {
        String text = "<option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000010|84\">B402 verbinding R4-E40</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000020|85\">R4 Oost: Gent-Zelzate Oost</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000030|86\">R4 West: Gent-Zelzate West</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000040|87\">N16 St-Niklaas-Temse brug-Willebroek</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000050|88\">N31 Brugge-Zeebrugge</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000060|89\">N60 Gent-Ronse</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000070|90\">N44 Aalter-Maldegem</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000080|91\">N74 Houthalen-Nederlandse grens</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000090|92\">N19/R14/N71 Geel-Neerpelt</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000100|93\">N21 Vilvoorde Luchthavenlaan-Brucargo</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000110|94\">R11 Mortsel-Wommelgem</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000120|95\">Provincie Antwerpen</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000130|96\">Provincie Vlaams-Brabant</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000140|97\">Provincie Oost-Vlaanderen</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000150|98\">Provincie West-Vlaanderen</option>\n" +
                "                         \t\t\t\t\t        <option style=\"font-family: arial, sans-serif; font-size: 11px;\" value=\"000160|99\">Provincie Limburg</option>";

        String[] lines = text.split("\n");

        List<String> stringEntries = new ArrayList<String>();
        List<String> enumEntries = new ArrayList<String>();
        for (String line : lines) {
            String[] lineParts = line.split("\">");
            String valueString = lineParts[0].substring(lineParts[0].length()-2, lineParts[0].length());
            int value = Integer.parseInt(valueString);
            String textToUse = lineParts[1].replace("</option>", "");

            String stringsEntry = "<item>" + textToUse + "</item>";
            String enumEntry = "SecondaryRoad_" + value + "(" + value + ")";

            stringEntries.add(stringsEntry);
            enumEntries.add(enumEntry);
        }

        System.out.println("Entries for the strings.xml files:");

        for (String s : stringEntries) {
            System.out.println(s);
        }

        System.out.println("Entries for the enum:");

        for (String s : enumEntries) {
            System.out.println(s + ",");
        }
    }
}
